package com.cryptape.cita_wallet.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by dengming on 18/1/20.
 */

public class TimeUtil {
    public static String FORMAT_YMDHMS = "yyyy-MM-dd HH:mm:ss";

    public static long getTime(String time){
//        String date = "2018-03-03 15:20:12";
        try {
            Date parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(time);
            return parse.getTime();
        } catch (ParseException e) {
            e.printStackTrace();
            return 0;
        }
    }

    public static String dateFormat(long millions, String pattern) {

        return new SimpleDateFormat(pattern).format(new Date(millions));
    }
}
